<?php

    /**
    * Update system files cache of Exponent, to speed up the system
    * @author trungdt
    * @since Aug 9, 2012
    * @copyright Absoft Viet Nam
    */
    if (!defined('EXPONENT')) exit('');

    //if (exponent_users_isAdmin() && isset($_REQUEST['content']) && isset($_REQUEST['file_id']))
    //{
    global $auto_dirs, $db;

    // scan dirs
    $data = null;
    //clear table system_classcache first
    $db->delete("system_classcache");
    foreach ($auto_dirs as $auto_dir) {
        $list_files = glob($auto_dir . "/*.php");
        foreach ( $list_files as $file_class)
        {
            $data->class_name = str_replace($auto_dir."/", "", $file_class);
            $data->class_path = $auto_dir;
            $db->insertObject($data, "system_classcache");
            echo "Found {$file_class}<br>";
        }
    }

    /*} else {
    echo SITE_403_HTML;
    }

    exponent_flow_redirect();*/
?>